import request from '@/config/axios'

export interface PassengerInfoVO {
  id?: number
  userId?: number
  username?: string
  nickname?: string
  realName?: string
  mobile?: string
  email?: string
  idCard?: string
  verifyFailReason?: string
  lastOrderTime?: Date
  invoiceableAmount?: number
  unInvoicedAmount?: number
  userLevel?: string
  level?: string
  growthValue?: number
  totalKilometers?: number
  monthlyKilometers?: number
  totalRechargeAmount?: number
  refundAmount?: number
  totalPayAmount?: number
  monthlyPayAmount?: number
  createTime?: Date
}

export interface PassengerInfoPageReqVO {
  userId?: number
  username?: string
  nickname?: string
  mobile?: string
  realName?: string
  userLevel?: string
  level?: string
  createTime?: Date[]
}

export interface PassengerInfoExcelReqVO {
  userId?: number
  username?: string
  nickname?: string
  mobile?: string
  realName?: string
  userLevel?: string
  level?: string
  createTime?: Date[]
}

// 查询乘客信息分页
export const getPassengerInfoPage = (params: PassengerInfoPageReqVO) => {
  return request.get({ url: '/system/passenger-info/page', params })
}

// 查询乘客信息详情
export const getPassengerInfo = (id: number) => {
  return request.get({ url: '/system/passenger-info/get?id=' + id })
}

// 新增乘客信息
export const createPassengerInfo = (data: PassengerInfoVO) => {
  return request.post({ url: '/system/passenger-info/create', data })
}

// 修改乘客信息
export const updatePassengerInfo = (data: PassengerInfoVO) => {
  return request.put({ url: '/system/passenger-info/update', data })
}

// 删除乘客信息
export const deletePassengerInfo = (id: number) => {
  return request.delete({ url: '/system/passenger-info/delete?id=' + id })
}

// 导出乘客信息 Excel
export const exportPassengerInfo = (params: PassengerInfoExcelReqVO) => {
  return request.download({ url: '/system/passenger-info/export-excel', params })
}

// 根据用户ID查询乘客信息
export const getPassengerInfoByUserId = (userId: number) => {
  return request.get({ url: '/system/passenger-info/get-by-user-id?userId=' + userId })
}